package com.shenxuchen.crm.service;

import com.shenxuchen.crm.mapper.ValueMapper;
import com.shenxuchen.crm.pojo.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ValueServiceImpl implements ValueService {

    @Resource
    private ValueMapper valueMapper;

    public String[] getHasRef(String[] codes) {
        return valueMapper.getHasRef(codes);
    }

    public List getAll() {
        return valueMapper.getAll();
    }

    public void save(Value value) {
        valueMapper.save(value);
    }

    public Value getById(String id) {
        return valueMapper.getById(id);
    }

    public Value getByIdWithType(String id) {
        return valueMapper.getByIdWithType(id);
    }

    public void edit(Value value) {
        valueMapper.edit(value);
    }

    public void delete(String[] ids) {
        valueMapper.delete(ids);
    }

    public List<Value> getAllWithType() {
        return valueMapper.getAllWithType();
    }

    public void dragChangeOrderNo(String[] ids) {
        for (int i = 0; i < ids.length; i++) {
            valueMapper.changeOrderNo(ids[i], i + 1);
        }
    }

    public List loadByCode(String code) {
        return valueMapper.loadByCode(code);
    }
}
